package com.maixun.lib_choosefile.ui.preview

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.bumptech.glide.Glide
import com.maixun.lib_choosefile.LocalFileConst
import com.maixun.lib_choosefile.R
import kotlinx.android.synthetic.main.fragment_preview_image.*

/**
 * @author：Lmoumou
 * @date：2020/10/20
 */
class PreviewImageFragment : Fragment() {
    companion object {
        fun newInstance(params: Bundle): Fragment {
            val fragment = PreviewImageFragment()
            fragment.arguments = params
            return fragment
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(R.layout.fragment_preview_image, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        Glide.with(this)
            .load(arguments?.getString(LocalFileConst.FILE_PATH))
            .into(mImageView)
    }
}